﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Entities
{
    /// <summary>
    /// Represents alls content information aricle in Forum
    /// </summary>
    public class Post
    {
        #region Variable Private
        private int _postID;
        private int _userID;
        private DateTime _postDate;
        private string _body;
        private bool _status;
        private IList<Reply> _replies;
        private int _categoryID;
        private string _title;
        private bool _sticky;
        private int _views;

        private int _numberOfReplies;

        public int NumberOfReplies
        {
            get
            {
                if (_replies != null)
                    return _replies.Count;
                return 0;
            }
        }


        public int CategoryID
        {
            get { return _categoryID; }
            set { _categoryID = value; }
        }

        #endregion

        #region Properties Public
        public int PostID
        {
            get { return _postID; }
            set { _postID = value; }
        }
        public int UserID
        {
            get { return _userID; }
            set { _userID = value; }
        }
        public DateTime PostDate
        {
            get { return _postDate; }
            set { _postDate = value; }
        }
        public string Body
        {
            get { return _body; }
            set { _body = value; }
        }
        public string FormattedBody
        {
            get { return _body; }
            set { _body = value; }
        }
        public bool Status
        {
            get { return _status; }
            set { _status = value; }
        }

        public IList<Reply> Replies
        {
            get { return _replies; }
            set { _replies = value; }
        }
        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }
        public bool Sticky
        {
            get { return _sticky; }
            set { _sticky = value; }
        }

        public int Views
        {
            get { return _views; }
            set { _views = value; }
        }
        #endregion

        #region Constructor
        public Post() { }
        public Post(int userId, DateTime postDate, string body, bool status)
        {
            this.UserID = userId;
            this.PostDate = postDate;
            this.Body = body;
            this.Status = status;
        }
        public Post(int postId, int userId, DateTime postDate, string body, bool status)
        {
            this.PostID = postId;
            this.UserID = userId;
            this.PostDate = postDate;
            this.Body = body;
            this.Status = status;
        }
        #endregion

    }
}
